package com.ad.pet.app;

/**
 * Created by z on.
 * Des:
 * Date: 2017/5/18
 */

public abstract class DelegateUseCaseCallback<R> implements UseCase.UseCaseCallback<R> {
    UseCase.UseCaseCallback mCallback;
    public DelegateUseCaseCallback(UseCase.UseCaseCallback  callback) {
        mCallback=callback;
    }


    @Override
    public void onStart() {
        if(mCallback!=null)mCallback.onStart();

    }

    @Override
    public void onSuccess(R response) {
        onNext(response);
    }

    @Override
    public void onError(String errorMsg) {
        if(mCallback!=null)  mCallback.onError(errorMsg);
    }

    @Override
    public void onComplete() {
        if(mCallback!=null)  mCallback.onComplete();
    }

    protected abstract void onNext(R response);
}
